package com.example.sjjg.utest.view

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.sjjg.utest.R

class MainActivity : AppCompatActivity() {
    var lifeCycle = -1

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        lifeCycle = 0
        setContentView(R.layout.root)
        val args = Bundle().apply {
            putString("name","li lei")
            putString("class","03")
            putInt("age",17)
            putString("email","li@yw.com")
        }
        val fragment = MainFragment().apply {
            arguments = args
        }
        supportFragmentManager.beginTransaction().replace(R.id.root,fragment,"MainFrgmt").commit()
    }

    override fun onStart() {
        super.onStart()
        lifeCycle = 1
    }

    override fun onRestart() {
        super.onRestart()
        lifeCycle = 5
    }

    override fun onResume() {
        super.onResume()
        lifeCycle = 2
    }

    override fun onPause() {
        super.onPause()
        lifeCycle = 3
    }

    override fun onStop() {
        super.onStop()
        lifeCycle = 4
    }

    override fun onDestroy() {
        super.onDestroy()
        lifeCycle = 6
    }

    override fun onTrimMemory(level: Int) {
        super.onTrimMemory(level)
    }
}